//
//  CGWService+HttpMessageManager.m
//  etionCBLogic
//
//  Created by chen on 14-2-14.
//  Copyright (c) 2014年 GuangZhouXuanWu. All rights reserved.
//

#import "GWService+HTTPManagerService.h"

#import "HTTPProtocolBase.h"

#import "XLGResult.h"

@implementation CGWService (HTTPManagerService)

-(NSInteger)HTTPRESTRequestURI:(NSString*)URI extendHeadField:(NSDictionary*)headField dicData:(NSDictionary*)dic HTTPMethod:(int)nMethod output:(NSDictionary**)output protocolError:(NSError**)error
{
    XLGHTTPProtocolBaseInternal *base=[[XLGHTTPProtocolBaseInternal new]autorelease_mm];
    base.URI = URI;
    base.dicData = dic;
    base.HTTPMethod = nMethod;
    if(headField.count > 0)
        [base.externRequestHead setDictionary:headField];
    return [self sendProtocol:base recvOutput:output protocolError:error];
}

- (XLGResult*)HTTPRESTRequestURI:(NSString*)URI extendHeadField:(NSDictionary*)headField dicData:(NSDictionary*)dic HTTPMethod:(int)nMethod
{
    XLGHTTPProtocolBaseInternal *base=[[XLGHTTPProtocolBaseInternal new]autorelease_mm];
    base.URI = URI;
    base.dicData = dic;
    base.HTTPMethod = nMethod;
    if(headField.count > 0)
        [base.externRequestHead setDictionary:headField];
    
    return [self sendProtocol:base];
}

//extend
-(NSInteger)HTTPRESTRequestURI:(NSString*)URI protocol:(EProtocolTransformType)protocol extendHeadField:(NSDictionary*)headField dicData:(NSDictionary*)dic HTTPMethod:(int)nMethod output:(NSDictionary**)output protocolError:(NSError**)error
{
    XLGHTTPProtocolBaseInternal *base=[[[XLGHTTPProtocolBaseInternal alloc] initWithProtocolType:protocol] autorelease_mm];
    base.URI = URI;
    base.dicData = dic;
    base.HTTPMethod = nMethod;
    if(headField.count > 0)
        [base.externRequestHead setDictionary:headField];
    return [self sendProtocol:base recvOutput:output protocolError:error];
}

- (XLGResult*)HTTPRESTRequestURI:(NSString*)URI protocol:(EProtocolTransformType)protocol extendHeadField:(NSDictionary*)headField dicData:(NSDictionary*)dic HTTPMethod:(int)nMethod
{
     XLGHTTPProtocolBaseInternal *base=[[[XLGHTTPProtocolBaseInternal alloc] initWithProtocolType:protocol] autorelease_mm];
    base.URI = URI;
    base.dicData = dic;
    base.HTTPMethod = nMethod;
    if(headField.count > 0)
        [base.externRequestHead setDictionary:headField];
    
    return [self sendProtocol:base];
}

@end
